package cn.matezk.cloud.beans;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class CreateTransfer {
    private String userId;
    private String accessToken;
    private String familyId;

    // 手动智能列表
    private List<String> manual;
    // 自动智能列表
    private List<String> auto;

    public void addManual(String sceneId) {
        if (ObjectUtil.isNull(manual))
            manual = new ArrayList<>();
        if (!manual.contains(sceneId)) {
            manual.add(sceneId);
        }
    }

    public void addAuto(String sceneId) {
        if (ObjectUtil.isNull(auto))
            auto = new ArrayList<>();
        if (!auto.contains(sceneId)) {
            auto.add(sceneId);
        }
    }

    public static void main(String[] args) {
        CreateTransfer transfer = new CreateTransfer();
        transfer.setUserId("572361149794750464");
        transfer.setFamilyId("f_5ff95c8a70714ac1a294d8f794bcb78a");
        transfer.setAccessToken("42e54b95574340ef81b6db402239c3be");
        transfer.addManual("s_5dec32bda75246a7b1cad0791d023f40");
        transfer.addManual("s_aa42b1ecd31242278df09c5b76278025");
        transfer.addAuto("a_270932b6ec05450c93e44c683f633590");
        System.out.printf(JSONUtil.toJsonStr(transfer));
    }
}
